import http from '../config'
import axios from 'axios'
import qs from 'qs'

export const getChartData2 = (url, data) => {
  let newAxios = axios.create({
    timeout: 300000,
    baseURL: 'http://analyapi.chinacpc.org'
  })
  newAxios.interceptors.request.use(config => {
    config.headers = {
      'Content-Type': 'application/json'
    }
    return config
  }, error => {
    Promise.reject(error)
  })
  // 响应拦截
  newAxios.interceptors.response.use(res => {
    return res
  }, error => {
    return Promise.reject(error)
  })
  return newAxios.post(url, data)
}

export const getChartData = (url, data) => {
  return http.post(url, qs.stringify(data))
}

export const getAllProvince = (url) => {
  return http.post(url)
}

export const getHospital = (url, data) => {
  return http.post(url, qs.stringify(data))
}

export const getCityByProvince = (url, data) => {
  return http.post(url, qs.stringify(data))
}
